<?php

declare(strict_types=1);

namespace App\CustHub\Controller;

use App\CustHub\Service\ChOpSchemeSyncSwitchService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;

#[Controller('ch/scheme/syncSwitch')]
class OpSchemeSyncSwitchController extends BaseController
{
    #[Inject]
    protected ChOpSchemeSyncSwitchService $service;

    #[PostMapping('info')]
    public function info()
    {
        return $this->success(['switch'=>$this->service->getInfo($this->request->all())]);
    }

    #[PostMapping('save')]
    public function save()
    {
        return $this->service->changeSwitch(
           $this->request->all()
        ) ? $this->success() : $this->error();
    }
}